﻿/*
Jolly Jumpers 
Time Limit:1000MS  Memory Limit:1024K


Description:
A sequence of n > 0 integers is called a jolly jumper
if the absolute values of the difference between successive elements
take on all the values 1 through n-1. For instance, 1 4 2 3 is a jolly jumper,
because the absolutes differences are 3, 2, and 1 respectively.
The definition implies that any sequence of a single integer is a jolly jumper.
You are to write a program to determine whether or not each of a number of sequences
is a jolly jumper.

Input:
Each line of input contains an integer n < 3000 followed by n integers representing the sequence. 
Output:
For each line of input, generate a line of output saying "Jolly" or "Not jolly". 
Sample Input:
4 1 4 2 3
5 1 4 2 -1 6
Sample Output:
Jolly
Not jolly
*/
/*
#include<iostream>
#include<string>
#include<fstream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
	//ifstream cin("1.txt");
	int m;
	while (cin >> m)
	{
		if (m == 1)
		{
			int qe;
			cin >> qe;
			cout << "Jolly" << endl;
			continue;
		}

		vector<int> aaa(m);
		vector<bool> bbb(m - 1, false);
		int i;
		for (i = 0; i < m; i++)
		{
			cin >> aaa[i];
		}
		for (i = 1; i < m; i++)
		{
			int temp = aaa[i] - aaa[i - 1];
			if (temp < 0)
				temp = -temp;
			if (temp == 0 || temp >= m)
				break;
			bbb[temp - 1] = true;
		}
		if (i < m)
		{
			cout << "Not jolly" << endl;
			continue;
		}

		for (i = 1; i < m; i++)
			if (!bbb[i - 1])
				break;
		if (i == m)
			cout << "Jolly";
		else
			cout << "Not jolly";	  
		cout << endl;
	}

	return 0;
}

*/
/*
#include<iostream>
#include<cmath>
#include<cstring>
using namespace std;
int main()
{
	for (unsigned n; cin>>n && n; )
	{		
		
		int minusend, subtrahend;		
		cin>>minusend;	
		if(1==n)
		{	
			cout<<"Jolly"<<endl;
			continue;
		}
		
		unsigned* hashes=new unsigned[n+1];
		memset(hashes, 0, (n+1)*sizeof(unsigned));
		bool is_jolly=true;
		for(unsigned i=1; i<n; ++i ) 
		{
			cin>>subtrahend;
			unsigned delta=abs(minusend-subtrahend);
			if(delta>=1 && delta<n && 0==hashes[delta])
			{
				hashes[delta]=1;
			}
			else
			{
				is_jolly=false;
				break;
			}
			minusend=subtrahend;
		}
		delete []hashes;
		hashes=NULL;

		if(is_jolly)
			cout<<"Jolly"<<endl;
		else
			cout<<"Not jolly"<<endl;
	}
	return EXIT_SUCCESS;
}
*/


#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
bool hashes[3002];
int main()
{
	for (unsigned n; EOF!=scanf("%u", &n) && n; )
	{		
		
		int minusend, subtrahend;		
		scanf("%d", &minusend);	
		if(1==n)
		{
			printf("Jolly\n");
			continue;
		}

		unsigned k=1;
		memset(hashes, false, (n+1)*sizeof(bool));
		{
			for(unsigned i=1; i<n; ++i ) 
			{
				scanf("%d", &subtrahend);
				unsigned delta=abs(minusend-subtrahend);
				if(delta>=1 && delta<n && !hashes[delta])
				{
					hashes[delta]=true;	
					++k;
				}
				minusend=subtrahend;
			}
		}
		if(k==n)
			printf("Jolly\n");
		else
			printf("Not jolly\n");
	}
	return EXIT_SUCCESS;
}

